
cap gen category=""
replace category="CABG" if proc_rea=="0406010927" | proc_rea=="0406010935"   | proc_rea=="0406010943" | proc_rea=="0406010951" | ///
proc_rea=="0406011206" /*CABG */

replace category="impla_of_heart_pacemaker" if (real(proc_rea)>= 0406010617  & real(proc_rea)<=0406010684) /*Implante de marcapasso */ 

replace category="Heart_valve_replacement" if proc_rea=="0406010692" /*IMPLANTE DE PRÓTESE VALVAR*/ 

replace category="Valvuloplasty" if  (real(proc_rea)>=0406010790 	& real(proc_rea)<=0406010820) /*Plastica VALVAR*/ 
/* Other vascular prodecures: */
replace category="embolectomy" if proc_rea=="0406020124" /* EMBOLECTOMIA ARTERIAL*/

replace category="Peripheral_artery_bypass" if (real(proc_rea)>= 0406020310  & real(proc_rea)<=0406020388) | (real(proc_rea)>=0406020418  & real(proc_rea)<=0406020450) /*Other bypass surgeries*/ 

replace category="Surgical_Management_of_Vascular_Trauma" if (real(proc_rea)>=0406020493 & real(proc_rea)<=0406020540) /* surgical treatment of vascular injuries */ 

/// /* Other  prodecures: */
replace category="Tracheostomy" if real(proc_rea )==0404010377 /*traqueostomia */  

replace category="Thoracotomy" if  real(proc_rea )==0412040166 |  real(proc_rea )== 0412040174 /*torascotomia */  

replace category="Craniotomy" if (real(proc_rea )>=0403010020 & real(proc_rea )<=0403010071)  /*  neurological system - intracerebral hemorragias*/ 

replace category="Ventriculoperitoneal shunting" if  (real(proc_rea )>=0403010080 & real(proc_rea )<=0403010101 ) /*DERIVAÇÃO RAQUE *** */ 

replace category="Surgical evacuation of intracerebral hemorrhage" if (real(proc_rea )>=0403010276 & real(proc_rea )<=0403010314) /*Head traumas *** */ 